﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL
{
    public partial class DataContext
    {
        CongNoEntities db = new CongNoEntities();
      public  List<ChiTietHoaDon> GetListChiTietHoaDon()
        {
            return db.ChiTietHoaDons.ToList();
        }
      public ChiTietHoaDon GetChiTietHoaDonById(Guid id)
        {
            return db.ChiTietHoaDons.Where(c=>c.MaChiTietHD==id).FirstOrDefault();
        }
      public void DeleteChiTietHoaDon(ChiTietHoaDon cthd)
      {
          db.Entry(cthd).State = EntityState.Deleted;
          db.SaveChanges();
      }
      public void InsertChiTietHoaDon(ChiTietHoaDon cthd)
      {
          db.Entry(cthd).State = EntityState.Added;
          db.SaveChanges();
      }
      public void UpdateChiTietHoaDon(ChiTietHoaDon cthd)
      {
          db.Entry(cthd).State = EntityState.Modified;
          db.SaveChanges();
      }
    }
}
